/*
 * SplashActivity.java
 * business
 *
 * Created by SunDing on 2016/9/9.
 *
 * Copyright (c) 2016年 yidiandao. All rights reserved.
 */

package com.yidiandao.business.ui.splash;

import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;

import com.yidiandao.business.R;
import com.yidiandao.business.base.BaseActivity;
import com.yidiandao.business.data.model.ConfigModel;
import com.yidiandao.business.utils.ActivityUtils;

/**
 * splash界面
 */
public class SplashActivity extends BaseActivity {

    private SplashFragment mFragment;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (!isTaskRoot()) {
            finish();
        }
    }

    @Override
    protected void initFragment() {
        mFragment =
                (SplashFragment)
                        getSupportFragmentManager().findFragmentById(R.id.container_splash);
        if (mFragment == null) {
            mFragment = SplashFragment.getInstance();
            ActivityUtils.addFragmentToActivity(
                    getSupportFragmentManager(), mFragment, R.id.container_splash);
        }
    }

    @Override
    protected void initPresenter() {
        new SplashPresenter(mFragment, new ConfigModel());
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_splash;
    }


    @Override
    protected void setFullScreen() {
        this.requestWindowFeature(Window.FEATURE_NO_TITLE); // 隐藏应用程序的标题栏，即当前activity的label
        this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); // 隐藏android系统的状态栏
    }

    @Override
    protected boolean dropPushMessage() {
        return true;
    }
}
